var MongoClient = require('mongodb').MongoClient
var url = "mongodb://localhost:27017/"

// 插入多条数据
MongoClient.connect(url, {useNewUrlParser: true, useUnifiedTopology: true}, function(err, db) {
  if (err) throw err
  var dbo = db.db("laochen")
  // 查询条件
  var whereStr = {"name": '老陈'}
  var updateStr = {$set: {"type": "胸怀天下"}}
  dbo.collection("users").updateMany(whereStr, updateStr, function(err, res) {
    if (err) throw err
    console.log(res.result.nModified + "条文档被更新");
    db.close()
  })
})

